#include "Zip.h"

#include <string.h>
#include <fan-llvm/core/Core.h>
#include "Type.h"
#include "UnsupportedErr.h"


Type* Zip_classType = NULL;
VTable* Zip_classVTable = NULL;


/**********************************************
 *
 * Methods and fields
 *
 **********************************************/


/* Str toStr() */
Str* Zip_toStr(Obj self)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Zip.toStr not implemented yet"));
}


/* Zip open(File file) */
Zip* Zip_open(File* file)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Zip.open not implemented yet"));
}


/* Zip read(InStream out) */
Zip* Zip_read(InStream* out)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Zip.read not implemented yet"));
}


/* Zip write(OutStream out) */
Zip* Zip_write(OutStream* out)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Zip.write not implemented yet"));
}


/* File? file() */
File* Zip_file(Zip* self)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Zip.file not implemented yet"));
}


/* [Uri:File]? contents() */
Map* Zip_contents(Zip* self)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Zip.contents not implemented yet"));
}


/* File? readNext() */
File* Zip_readNext(Zip* self)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Zip.readNext not implemented yet"));
}


/* OutStream writeNext(Uri path, DateTime modifyTime) */
OutStream* Zip_writeNext_1(Zip* self, Uri* path)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Zip.writeNext not implemented yet"));
}


/* OutStream writeNext(Uri path, DateTime modifyTime) */
OutStream* Zip_writeNext(Zip* self, Uri* path, DateTime* modifyTime)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Zip.writeNext not implemented yet"));
}


/* Bool finish() */
Bool Zip_finish(Zip* self)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Zip.finish not implemented yet"));
}


/* Bool close() */
Bool Zip_close(Zip* self)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Zip.close not implemented yet"));
}


/**********************************************
 *
 * Type-system functions
 *
 **********************************************/


Type* Zip_initType(void)
{
  if (Zip_classType == NULL)
  {
    Type* baseType = Obj_initType();
    VTable* vtable = Zip_initVTable();
    Type* type = Type_new("Zip", baseType, vtable, sizeof(Zip), sizeof(ZipVTable));
    Type_registerMethodImplementation(type, "close", Zip_close, 0);
    Type_registerMethodImplementation(type, "contents", Zip_contents, 0);
    Type_registerMethodImplementation(type, "file", Zip_file, 0);
    Type_registerMethodImplementation(type, "finish", Zip_finish, 0);
    Type_registerMethodImplementation(type, "open", Zip_open, 1);
    Type_registerMethodImplementation(type, "read", Zip_read, 1);
    Type_registerMethodImplementation(type, "readNext", Zip_readNext, 0);
    Type_registerMethodImplementation(type, "toStr", Zip_toStr, 0);
    Type_registerMethodImplementation(type, "write", Zip_write, 1);
    Type_registerMethodImplementation(type, "writeNext", Zip_writeNext_1, 1);
    Type_registerMethodImplementation(type, "writeNext", Zip_writeNext, 2);
    Zip_classType = type;
    Zip_initStatic();
  }
  return Zip_classType;
}


VTable* Zip_initVTable(void)
{
  if (Zip_classVTable == NULL)
  {
    VTable* vtable = memoryAlloc(sizeof(ZipVTable));
    memcpy(vtable, Obj_initVTable(), sizeof(FanObjVTable));
    ((FanObjVTable*)vtable)->toStr = Zip_toStr;
    Zip_classVTable = vtable;
  }
  return Zip_classVTable;
}


void Zip_initStatic(void)
{
}
